package com.ly.heart.service.impl;

import java.util.Collections;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.heart.domain.dto.KingInventoryMaterialQueryDto;
import com.ly.heart.domain.dto.KingOrderMaterialQueryDto;
import com.ly.heart.domain.dto.KingProcureRefundQueryDto;
import com.ly.heart.domain.dto.ReceiveNoticeMaterialQueryDto;
import com.ly.heart.domain.vo.KingProcureRefundVo;
import com.ly.heart.domain.vo.OrderSumResult;
import com.ly.heart.mapper.KingProcureRefundMaterialMapper;
import com.ly.heart.service.IKingProcureRefundMaterialService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.KingProcureRefundMaterialEntity;

import javax.annotation.Resource;

/**
 * 金蝶-采购退料单物料明细Service业务层处理
 *
 * @author cxl
 * @date 2024-07-16
 */
@Service
public class KingProcureRefundMaterialServiceImpl extends ServiceImpl<KingProcureRefundMaterialMapper, KingProcureRefundMaterialEntity> implements IKingProcureRefundMaterialService {

    @Resource
    private KingProcureRefundMaterialMapper kingProcureRefundMaterialMapper;

    @Override
    public List<KingProcureRefundVo> getKingProcureRefundList(KingProcureRefundQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.getKingProcureRefundList(queryDto);
    }

    /**
     * 查询金蝶-采购退料单物料明细
     *
     * @param id 金蝶-采购退料单物料明细ID
     * @return 金蝶-采购退料单物料明细
     */
    @Override
    public KingProcureRefundMaterialEntity selectKingProcureRefundMaterialEntityById ( String id ) {
        return kingProcureRefundMaterialMapper.selectKingProcureRefundMaterialEntityById ( id );
    }

    /**
     * 查询金蝶-采购退料单物料明细列表
     *
     * @param kingProcureRefundMaterialEntity 金蝶-采购退料单物料明细
     * @return 金蝶-采购退料单物料明细
     */
    @Override
    public List<KingProcureRefundMaterialEntity> selectKingProcureRefundMaterialEntityList ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity ) {
        return kingProcureRefundMaterialMapper.selectKingProcureRefundMaterialEntityList ( kingProcureRefundMaterialEntity );
    }

    @Override
    public List<KingProcureRefundMaterialEntity> queryRelationList ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity ) {
        List<KingProcureRefundMaterialEntity> kingProcureRefundMaterialEntities = kingProcureRefundMaterialMapper.queryRelationList ( kingProcureRefundMaterialEntity );
        return kingProcureRefundMaterialEntities;
    }


    /**
     * 新增金蝶-采购退料单物料明细
     *
     * @param kingProcureRefundMaterialEntity 金蝶-采购退料单物料明细
     * @return 结果
     */
    @Override
    public int insertKingProcureRefundMaterialEntity ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity ) {
        kingProcureRefundMaterialEntity.setCreateTime ( DateUtils.getNowDate () );
        return kingProcureRefundMaterialMapper.insertKingProcureRefundMaterialEntity ( kingProcureRefundMaterialEntity );
    }

    /**
     * 修改金蝶-采购退料单物料明细
     *
     * @param kingProcureRefundMaterialEntity 金蝶-采购退料单物料明细
     * @return 结果
     */
    @Override
    public int updateKingProcureRefundMaterialEntity ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity ) {
        kingProcureRefundMaterialEntity.setUpdateTime ( DateUtils.getNowDate () );
        return kingProcureRefundMaterialMapper.updateKingProcureRefundMaterialEntity ( kingProcureRefundMaterialEntity );
    }

    /**
     * 批量删除金蝶-采购退料单物料明细
     *
     * @param ids 需要删除的金蝶-采购退料单物料明细ID
     * @return 结果
     */
    @Override
    public int deleteKingProcureRefundMaterialEntityByIds ( String[] ids ) {
        return kingProcureRefundMaterialMapper.deleteKingProcureRefundMaterialEntityByIds ( ids );
    }

    /**
     * 删除金蝶-采购退料单物料明细信息
     *
     * @param id 金蝶-采购退料单物料明细ID
     * @return 结果
     */
    @Override
    public int deleteKingProcureRefundMaterialEntityById ( String id ) {
        return kingProcureRefundMaterialMapper.deleteKingProcureRefundMaterialEntityById ( id );
    }

    @Override
    public List<KingProcureRefundMaterialEntity> selectMaterialByOrderIdAndMaterialId(KingOrderMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.selectMaterialByOrderIdAndMaterialId(queryDto);
    }

    @Override
    public List<KingProcureRefundMaterialEntity> selectMaterialByOrderIdAndMaterialIdAndType(KingOrderMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.selectMaterialByOrderIdAndMaterialIdAndType(queryDto);
    }

    @Override
    public OrderSumResult getMaterialNumByOrderIdAndMaterialId(KingOrderMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.getMaterialNumByOrderIdAndMaterialId(queryDto);
    }

    @Override
    public OrderSumResult getMaterialNumByOrderIdAndMaterialIdAndType(KingOrderMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.getMaterialNumByOrderIdAndMaterialIdAndType(queryDto);
    }

    @Override
    public String getMaterialNumByInventoryIdAndMaterialId(KingInventoryMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.getMaterialNumByInventoryIdAndMaterialId(queryDto);
    }

    @Override
    public String getReturnNumByInventoryIdAndMaterialId(KingInventoryMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.getMaterialReturnNumByInventoryIdAndMaterialId(queryDto);
    }

    @Override
    public String getReturnReplenishTotalPriceTaxByInventoryIdAndMaterialId(KingInventoryMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.getReturnReplenishTotalPriceTaxByInventoryIdAndMaterialId(queryDto);
    }

    @Override
    public String getReturnNumByReceiveNotice(ReceiveNoticeMaterialQueryDto queryDto) {
        return kingProcureRefundMaterialMapper.getReturnNumByReceiveNotice(queryDto);
    }
}
